; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=ipsccp -S | FileCheck %s
; Return value can't be zapped if there is a call that has operand bundle
; "clang.arc.attachedcall".

@g0 = global i8 zeroinitializer, align 1

define internal ptr @foo() {
; CHECK-LABEL: @foo(
; CHECK-NEXT:    ret ptr @g0
;
  ret ptr @g0
}

define void @test() {
; CHECK-LABEL: @test(
; CHECK-NEXT:    [[R:%.*]] = call ptr @foo() [ "clang.arc.attachedcall"(ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue) ]
; CHECK-NEXT:    call void (...) @llvm.objc.clang.arc.noop.use(ptr [[R]])
; CHECK-NEXT:    ret void
;
  %r = call ptr @foo() [ "clang.arc.attachedcall"(ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue) ]
  call void (...) @llvm.objc.clang.arc.noop.use(ptr %r)
  ret void
}

declare ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue(ptr)
declare void @llvm.objc.clang.arc.noop.use(...)
